package myauctioneer;

import javax.servlet.http.HttpSession;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.Vector;

public class Article
{
	/**
	 * SQL DDL
	 * 
	 * "ITEM_ID"     NUMBER(6,0) NOT NULL ENABLE,
	 * "BRAND"       VARCHAR2(20 BYTE),
	 * "FAMILY_LINE" VARCHAR2(20 BYTE),
	 * "MODEL"       VARCHAR2(20 BYTE),
	 * "CONDITION"   VARCHAR2(20 BYTE),
	 * "DESCRIPTION" VARCHAR2(160 BYTE),
	 * "CREATED_AT" DATE,
	 * "VALID_UNTIL" DATE,
	 * "CATEGORY"    VARCHAR2(20 BYTE),
	 * "PRICE"       NUMBER(8,2),
	 * "SALE_TYPE"   VARCHAR2(20 BYTE),
	 * "FINAL_BID"   NUMBER(6,0),
	 * "CUSTOMER_ID" NUMBER(6,0)
	 */
	 
	private int  item_id;
	private String  brand;
	private String  family_line;
	private String  model;
	private String  condition;
	private String  description;
	private Date  created_at;
	private Date  valid_until;
	private String  category;
	private double  price;
	private String  sale_type;
	private int  final_bid;
	private int  customer_id;
	

	/**
	 *	Setter
	 */
	public void setItem_id(int v) { this.item_id=v; }
	public void setBrand(String v) { this.brand=v; }
	public void setFamily_line(String v) { this.family_line=v; }
	public void setModel(String v) { this.model=v; }
	public void setCondition(String v) { this.condition=v; }
	public void setDescription(String v) { this.description=v; }
	public void setCreated_at(Date v) { this.created_at=v; }
	public void setValid_until(Date v) { this.valid_until=v; }
	public void setCategory(String v) { this.category=v; }
	public void setPrice(double v) { this.price=v; }
	public void setSale_type(String v) { this.sale_type=v; }
	public void setFinal_bid(int v) { this.final_bid=v; }
	public void setCustomer_id(int v) { this.customer_id=v; }

	/**
	 *	Getter
	 */
	public int getItem_id() { return this.item_id; }
	public String getBrand() { return this.brand; }
	public String getFamily_line() { return this.family_line; }
	public String getModel() { return this.model; }
	public String getCondition() { return this.condition; }
	public String getDescription() { return this.description; }
	public Date getCreated_at() { return this.created_at; }
	public Date getValid_until() { return this.valid_until; }
	public String getCategory() { return this.category; }
	public double getPrice() { return this.price; }
	public String getSale_type() { return this.sale_type; }
	public int getFinal_bid() { return this.final_bid; }
	public int getCustomer_id() { return this.customer_id; }
	
	public Article(Vector v) {
		setItem_id(((Integer)v.get(0)).intValue());
		setBrand((String)v.get(1));
		setFamily_line((String)v.get(2));
		setModel((String)v.get(3));
		setCondition((String)v.get(4));
		setDescription((String)v.get(5));
		setCreated_at((Date)v.get(6));
		setValid_until((Date)v.get(7));
		setCategory((String)v.get(8));
		setPrice(((Double)v.get(9)).doubleValue());
		setSale_type((String)v.get(10));
		setFinal_bid(((Integer)v.get(11)).intValue());
		setCustomer_id(((Integer)v.get(12)).intValue());
	}

	
//	protected App app;

/*	//use other kind of declaration	
	public Article(App app)
	{
		this.app = app;
	}
*/
/*	//no need here	
	/**
	 * insert/update data to db
	 * /
	public Article save() {
		//
		return this;
	}

	/**
	 * load data from db
	 * /
	public Article load(int id) {
		//
		return this;
	}
*/
}
